package com.bosssoft.trainee.nontax.common.eception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author Luo Wenlong
 * @date 2022-06-26 14:57
 * @description: dao层统一异常处理
 * @version: 1.0.0
 */
@Slf4j
@ControllerAdvice(annotations = Service.class)
public class DaoExceptionHandler {
    @ExceptionHandler({Exception.class})
    public void handlerException(Exception e) {
        log.error("service error: " + e.getMessage());
        for (StackTraceElement element : e.getStackTrace()) {
            log.error(element.toString());
        }
    }
}
